﻿<UserControl x:Class="ChristianMoser.WpfInspector.UserInterface.EventsView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:c="clr-namespace:ChristianMoser.WpfInspector.UserInterface.Controls">
    <Grid>
        <c:UpdateTriggerControl UpdateTrigger="{Binding UpdateTrigger}" />
        <DockPanel>
            <Expander DockPanel.Dock="Top">
                <Expander.Header>
                    <TextBlock Text="Configure handled events..."  />
                </Expander.Header>
                <ItemsControl ItemsSource="{Binding EventHandlers}" >
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <CheckBox Content="{Binding Name}"  IsChecked="{Binding IsEnabled}" />
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                    <ItemsControl.GroupStyle>
                        <GroupStyle>
                            <GroupStyle.ContainerStyle>
                                <Style TargetType="{x:Type GroupItem}">
                                    <Setter Property="Margin" Value="0,0,0,2"/>
                                    <Setter Property="Template">
                                        <Setter.Value>
                                            <ControlTemplate TargetType="{x:Type GroupItem}">
                                                <StackPanel>
                                                    <TextBlock Text="{Binding Name}" FontWeight="Bold" />
                                                    <ItemsPresenter />
                                                </StackPanel>
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                            </GroupStyle.ContainerStyle>
                        </GroupStyle>
                    </ItemsControl.GroupStyle>
                </ItemsControl>
            </Expander>
            <ListBox ItemsSource="{Binding Events}">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Name}" />
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </DockPanel>
    </Grid>
</UserControl>
